import tkinter as tk
import random
import threading
import time
import sys
from random import choice


def show_warm_tip():
    window = tk.Tk()
    screen_width=window.winfo_screenwidth()
    screen_height=window.winfo_screenheight()

    window_width = 250
    window_height = 60
    x = random.randrange(0,screen_width-window_width)
    y = random.randrange(0,screen_height-window_height)

    window.title('杰出青年群')
    window.geometry(f"{window_width}x{window_height}+{x}+{y}")
    tips=[
        '新年快乐','万事如意','心想事成','过好每一天','开开心心','快快乐乐','早点休息',
        '多喝热水','梦想成真','顺顺利利','别熬夜',
    ]
    tip = random.choice(tips)
    bg_colors=[
        'lightblue','coral','bisque','lavender',
        'plum',
        'skyblue',
        'lightgreen',
        'lightyellow',
        'oldlace',
    ]
    bg=random.choice(bg_colors)

    tk.Label(
        window,
        text=tip,
        bg=bg,
        font=('微软雅黑',16),
        width=60,
        height=3
    ).pack()

    window.attributes('-topmost', True)

    window.after(10000, window.destroy)

    def on_space(event):
        window.destroy()
        for t in threads:
            if t.is_alive():
                pass
        sys.exit()
    window.bind('<space>', on_space)
    window.mainloop()
threads=[]
for i in range(30):
    t = threading.Thread(target=show_warm_tip)
    threads.append(t)
    time.sleep(0.005)
    threads[-1].start()